class BrowserHistory
{
public:
    BrowserHistory(string homepage)
    {
        history = {homepage};
        count = 1;
        current = 0;
    }

    void visit(string url)
    {
        ++current;
        count = current + 1;
        if (current < history.size())
        {
            history[current] = url;
        }
        else
        {
            history.push_back(url);
        }
    }

    string back(int steps)
    {
        current = max(0, current - steps);
        return history[current];
    }

    string forward(int steps)
    {
        current = min(count - 1, current + steps);
        return history[current];
    }

private:
    int count;
    int current;
    vector<string> history;
};

/**
 * Your BrowserHistory object will be instantiated and called as such:
 * BrowserHistory* obj = new BrowserHistory(homepage);
 * obj->visit(url);
 * string param_2 = obj->back(steps);
 * string param_3 = obj->forward(steps);
 */